package com.aspose.cells;

import java.util.HashMap;

public class ListObject {
   private int i;
   private int j;
   private int k;
   private int l;
   private int m;
   private String n;
   private ListColumnCollection o;
   private ListObjectCollection p;
   HashMap a;
   byte[] b;
   int c;
   private long q;
   private String r;
   private String s;
   private int t;
   private int u;
   private int v;
   private int w;
   private int x = -1;
   private byte[] y;
   AutoFilter d;
   private String z;
   private String A;
   private byte B = 4;
   private Object C;
   Style e;
   Style f;
   Style g;
   int[] h = new int[]{-1, -1, -1, -1, -1, -1};
   private int D = 1;
   private int E = 0;
   private ListObject.za F = null;

   int a() {
      return this.i;
   }

   ListObject(ListObjectCollection parent, String name, int id) {
      this.p = parent;
      this.n = name;
      this.z = name;
      this.i = id;
      this.d = new AutoFilter(this.g().d(), this);
      if (this.g().d().c().Z() == null) {
         this.C = 30;
      }

      this.o = new ListColumnCollection(this);
   }

   ListObject(ListObjectCollection parent) {
      this.p = parent;
      this.d = new AutoFilter(this.g().d(), this);
      this.o = new ListColumnCollection(this);
   }

   void a(ListObject var1, CopyOptions var2) {
      if (var2.a) {
         this.i = var1.i;
         this.n = var1.n;
         this.z = var1.z;
      }

      if (var1.b != null) {
         this.b = new byte[var1.b.length];
         System.arraycopy(var1.b, 0, this.b, 0, this.b.length);
      }

      this.a = var1.a;
      this.j = var1.j;
      this.k = var1.k;
      this.l = var1.l;
      this.m = var1.m;
      if (var1.d != null) {
         this.d = new AutoFilter(this.g().d(), this);
         this.d.a(var1.d);
      }

      this.u = var1.u;
      this.v = var1.v;
      this.A = var1.A;
      this.x = var1.x;
      this.r = var1.r;
      this.c = var1.c;
      this.s = var1.s;
      this.y = var1.y;
      this.D = var1.D;
      this.w = var1.w;
      this.q = var1.q;
      this.t = var1.t;
      this.B = var1.B;
      this.C = var1.C;
      if (this.g().d().c() != var1.g().d().c() && var1.C != null && var1.C instanceof String) {
         String var3 = (String)var1.C;
         WorksheetCollection var4 = this.g().d().c();
         TableStyleCollection var5 = var4.getTableStyles();
         TableStyle var6 = var5.get(var3);
         if (var6 == null) {
            int var7 = var5.addTableStyle(var3);
            var6 = var5.get(var7);
            WorksheetCollection var8 = var1.g().d().c();
            TableStyleCollection var9 = var8.getTableStyles();
            TableStyle var10 = var9.get(var3);
            if (var10 != null) {
               var6.a(var10);
            }
         }
      }

      this.E = var1.E;
      this.o = new ListColumnCollection(this);
      this.o.a(var1.getListColumns(), var2);

      for(int var11 = 0; var11 < var1.h.length; ++var11) {
         this.h[var11] = var1.h[var11];
         if (var1.h[var11] != -1 && this.F() != var1.F()) {
            this.h[var11] = this.F().getDxfs().a(var1.F().getDxfs().get(var1.h[var11]));
         }
      }

   }

   private WorksheetCollection F() {
      return this.g().d().c();
   }

   public int getStartRow() {
      return this.j;
   }

   void a(int var1) {
      this.j = var1;
   }

   public int getStartColumn() {
      return this.l;
   }

   void b(int var1) {
      this.l = var1;
   }

   public int getEndRow() {
      return this.k;
   }

   void c(int var1) {
      this.k = var1;
   }

   public int getEndColumn() {
      return this.m;
   }

   void d(int var1) {
      this.m = var1;
   }

   public ListColumnCollection getListColumns() {
      return this.o;
   }

   void e(int var1) {
      Worksheet var2 = this.p.d();
      Cells var3 = this.p.d().getCells();
      boolean var4 = false;
      int var7;
      if (var1 != 0) {
         Row var5 = var3.getRows().get(var1 - 1);
         String[] var6 = new String[this.getListColumns().getCount()];

         for(var7 = 0; var7 < this.getListColumns().getCount(); ++var7) {
            var6[var7] = this.getListColumns().get(var7).h();
            if (var6[var7] != null) {
               var4 = true;
            }
         }

         if (var4) {
            for(var7 = var1; var7 <= this.k; ++var7) {
               Row var8 = var3.getRows().get(var7);

               for(int var9 = 0; var9 < var6.length; ++var9) {
                  if (var6[var9] != null) {
                     Cell var10 = var8.get(var9 + this.l);
                     var10.setFormula(var6[var9]);
                     int var11 = this.j + 1;
                     int var12 = var7 - var11;
                     if (!this.getShowHeaderRow()) {
                        --var11;
                        ++var12;
                     }

                     if (var12 != 0) {
                        zyo.a(var2, true, var11, var12, var11, var7, -1, -1, var10.g().b);
                     }
                  }
               }
            }
         }
      }

      int var13;
      CellArea var16;
      for(var13 = 0; var13 < var2.getConditionalFormattings().getCount(); ++var13) {
         FormatConditionCollection var14 = var2.getConditionalFormattings().get(var13);

         for(var7 = 0; var7 < var14.b.size(); ++var7) {
            var16 = (CellArea)var14.b.get(var7);
            if (var16.EndRow == var1 - 1 && var16.StartColumn >= this.l && var16.EndColumn <= this.m) {
               var16.EndRow = this.k;
               var14.b.set(var7, var16);
               break;
            }
         }
      }

      for(var13 = 0; var13 < var2.getValidations().getCount(); ++var13) {
         Validation var15 = var2.getValidations().get(var13);

         for(var7 = 0; var7 < var15.a.size(); ++var7) {
            var16 = (CellArea)var15.a.get(var7);
            if (var16.EndRow == var1 - 1 && var16.StartColumn >= this.l && var16.EndColumn <= this.m) {
               var16.EndRow = this.k;
               var15.a.set(var7, var16);
               break;
            }
         }
      }

   }

   public void resize(int startRow, int startColumn, int endRow, int endColumn, boolean hasHeaders) {
      if (this.j != startRow || this.l != startColumn || this.k != endRow || this.m != endColumn || !hasHeaders) {
         CellArea var6 = new CellArea();
         var6.StartRow = this.k;
         var6.StartColumn = this.l;
         var6.EndRow = this.k;
         var6.EndColumn = this.m;
         this.j = startRow;
         this.l = startColumn;
         this.k = endRow + (hasHeaders ? 0 : 1);
         this.m = endColumn;
         if (this.q()) {
            this.getAutoFilter().setRange(startRow, startColumn, endColumn);
         }

         boolean var7 = var6.EndColumn < startColumn || var6.StartColumn > endColumn;
         ListColumn[] var8 = null;
         int var9 = 1;
         if (!var7) {
            var8 = new ListColumn[this.o.getCount()];

            for(int var10 = 0; var10 < this.o.getCount(); ++var10) {
               var8[var10] = this.o.get(var10);
               if (var9 < var8[var10].o) {
                  var9 = var8[var10].o;
               }
            }
         }

         this.o.clear();
         Cells var17 = this.p.d().getCells();
         if (!hasHeaders) {
            CellArea var11 = new CellArea();
            var11.StartRow = startRow;
            var11.StartColumn = startColumn;
            var11.EndRow = endRow;
            var11.EndColumn = endColumn;
            var17.insertRange(var11, 1, 0, false);
         }

         for(int var18 = 1; var18 <= this.m - this.l + 1; ++var18) {
            String var12 = null;
            int var13 = var18 + this.l - 1;
            Cell var14 = var17.a(this.j, var13, false);
            if (hasHeaders) {
               if ("".equals(var14.j())) {
                  var12 = "Column" + com.aspose.cells.b.a.zo.a(var18);
                  var14.putValue(var12);
               } else {
                  var12 = var14.j();
                  var14.putValue(var12);
               }
            } else {
               var12 = "Column" + com.aspose.cells.b.a.zo.a(var18);
               var14.putValue(var12);
            }

            Style var15 = var14.o();
            var15.getFont().setBold(true);
            var14.a(var15);
            ListColumn var16 = null;
            if (var13 >= var6.StartColumn && var13 <= var6.EndColumn) {
               var16 = var8[var13 - var6.StartColumn];
            } else {
               var16 = new ListColumn(this.o, var12, var9);
               ++var9;
            }

            this.o.a(var16);
         }

         var6.StartColumn = startColumn;
         var6.EndColumn = endColumn;
         if (endRow > var6.EndRow) {
            this.e(var6.EndRow + 1);
         }

      }
   }

   void a(int var1, int var2, int var3, int var4, boolean var5) {
      this.j = var1;
      this.l = var2;
      this.k = var3 + (var5 ? 0 : 1);
      this.m = var4;
      this.getAutoFilter().setRange(var1, var2, var4);
      this.o = new ListColumnCollection(this);
      Cells var6 = this.p.d().getCells();
      if (!var5) {
         CellArea var7 = new CellArea();
         var7.StartRow = var1;
         var7.StartColumn = var2;
         var7.EndRow = var3;
         var7.EndColumn = var4;
         var6.insertRange(var7, 1, 0, false);
      }

      for(int var12 = 1; var12 <= this.m - this.l + 1; ++var12) {
         String var8 = null;
         Cell var9 = var6.a(this.j, var12 + this.l - 1, false);
         if (var5) {
            if ("".equals(var9.j())) {
               var8 = "Column" + com.aspose.cells.b.a.zo.a(var12);
               var9.putValue(var8);
            } else {
               var8 = var9.j();
               var9.putValue(var8);
            }
         } else {
            var8 = "Column" + com.aspose.cells.b.a.zo.a(var12);
            var9.putValue(var8);
         }

         Style var10 = var9.o();
         var10.getFont().setBold(true);
         var9.a(var10);
         ListColumn var11 = new ListColumn(this.o, var8, var12 - 1);
         this.o.a(var11);
      }

   }

   public void putCellValue(int rowOffset, int columnOffset, Object value) {
      Worksheet var4 = this.g().d();
      Cells var5 = var4.getCells();
      int var6 = this.j + rowOffset;
      int var7 = this.l + columnOffset;
      Cell var8 = var4.getCells().get(var6, var7);
      if (var6 == this.k + 1) {
         var8.putValue(value);
         if (columnOffset >= 0 && var7 <= this.m) {
            this.k = var6;
            this.e(var6);
         }

      } else {
         if (var7 == this.m + 1) {
            var8.putValue(value);
            if (var6 >= this.j && var6 <= this.k) {
               ++this.m;
               String var9 = "Column" + com.aspose.cells.a.c.zp.a(columnOffset);
               if (this.getShowHeaderRow()) {
                  if (var6 == this.j) {
                     var9 = var8.getStringValue();
                  } else {
                     Cell var10 = var5.get(this.j, this.m);
                     var10.putValue(var9);
                  }
               }

               ListColumn var17 = new ListColumn(this.o, var9, columnOffset);
               this.o.a(var17);
            }
         } else if (var7 <= this.m && var7 >= this.l) {
            if (this.getShowHeaderRow() && var6 == this.j) {
               var8.putValue(value);
               this.getListColumns().get(columnOffset).a(var8.getStringValue());
            } else if (var6 >= this.j && var6 <= this.k) {
               Range var16 = var5.createRange(var6, this.l, 1, this.m - this.l + 1);
               if (var16.c()) {
                  var8.putValue(value);

                  for(int var18 = this.l; var18 <= this.m; ++var18) {
                     if (var18 != columnOffset) {
                        ListColumn var11 = this.getListColumns().get(var18 - this.l);
                        String var12 = var11.h();
                        if (var12 != null) {
                           Cell var13 = var5.get(var6, var18);
                           var13.setFormula(var12);
                           int var14 = this.j + 1;
                           int var15 = rowOffset - 1;
                           if (!this.getShowHeaderRow()) {
                              --var14;
                              ++var15;
                           }

                           zyo.a(var4, true, var14, var15, var14, var6, -1, -1, var13.g().b);
                        }
                     }
                  }
               } else {
                  var8.putValue(value);
               }
            }
         } else {
            var8.putValue(value);
         }

      }
   }

   public boolean getShowHeaderRow() {
      return this.y() == 1;
   }

   public void setShowHeaderRow(boolean value) {
      if (this.y() == 1 != value) {
         if (value) {
            this.b();
            Cells var2 = this.g().d().getCells();
            Cell var3 = var2.a(this.getStartRow(), this.getStartColumn(), false);
            Style var4 = var3.o();
            var4.getFont().setBold(true);
            var3.a(var4);

            for(int var5 = 1; var5 < this.getListColumns().getCount(); ++var5) {
               var3 = var2.a(this.getStartRow(), this.getStartColumn() + var5, false);
               var3.b(var3.s());
            }

            if (this.y() == 0) {
               this.l(1);
            }
         } else {
            if (this.y() == 1) {
               this.c();
            }

            this.l(0);
         }

      }
   }

   void b() {
      Cells var1 = this.g().d().getCells();
      --this.j;
      Row var2 = var1.getRows().a(this.j, false, true, false);

      int var3;
      for(var3 = 0; var3 < this.getListColumns().getCount(); ++var3) {
         var2.get(this.l + var3).putValue(this.getListColumns().get(var3).getName());
      }

      var3 = this.getEndRow();
      if (this.getListColumns().b()) {
         --var3;
      }

      this.getAutoFilter().setRange(CellsHelper.cellIndexToName(this.getStartRow(), this.getStartColumn()) + ":" + CellsHelper.cellIndexToName(var3, this.getEndColumn()));
   }

   void c() {
      Cells var1 = this.g().d().getCells();
      int var2 = var1.getRows().d(this.j);
      if (var2 != -1) {
         var1.getRows().removeAt(var2);
      }

      ++this.j;
      this.getAutoFilter().setRange((String)null);
   }

   public boolean getShowTotals() {
      return this.j();
   }

   public void setShowTotals(boolean value) {
      if (this.j() != value) {
         this.b(value);
         if (value) {
            this.d();
            Cells var2 = this.g().d().getCells();
            Cell var3 = var2.a(this.getEndRow(), this.getStartColumn(), false);
            var3.putValue("Total");
            Style var4 = var3.o();
            var4.getFont().setBold(true);
            var3.a(var4);

            for(int var5 = 1; var5 < this.getListColumns().getCount(); ++var5) {
               var3 = var2.a(this.getEndRow(), this.getStartColumn() + var5, false);
               var3.b(var3.s());
               if (this.getListColumns().get(var5).k() != null) {
                  var3.putValue(this.getListColumns().get(var5).k());
               }
            }

            ListColumn var6 = this.getListColumns().get(this.getListColumns().getCount() - 1);
            if (var6.k() == null && var6.getTotalsCalculation() == 0) {
               this.getListColumns().get(this.getListColumns().getCount() - 1).setTotalsCalculation(6);
            }

            if (this.A() == 0) {
               this.m(1);
            }
         } else {
            if (this.getListColumns().b()) {
               this.e();
            }

            this.m(0);
         }

      }
   }

   void d() {
      Cells var1 = this.g().d().getCells();
      CellArea var2 = new CellArea();
      var2.StartColumn = this.getStartColumn();
      var2.EndColumn = this.getEndColumn();
      var2.StartRow = this.getEndRow() + 1;
      var2.EndRow = this.getEndRow() + 1;
      var1.insertRange(var2, 0);
      ++this.k;
   }

   void e() {
      Cells var1 = this.g().d().getCells();
      var1.deleteRange(this.getEndRow(), (byte)this.getStartColumn() & 255, this.getEndRow(), (byte)this.getEndColumn() & 255, 4);
      --this.k;
   }

   public Range getDataRange() {
      int var1 = this.getEndRow() - this.getStartRow();
      int var2 = this.getStartRow() + 1;
      if (!this.getShowHeaderRow()) {
         ++var1;
         var2 = this.getStartRow();
      }

      if (this.getShowTotals()) {
         --var1;
      }

      Range var3 = new Range(var2 & '\uffff', (byte)this.getStartColumn() & 255, var1, (short)this.getListColumns().getCount(), this.g().d().getCells());
      return var3;
   }

   public void updateColumnName() {
      if (this.getShowHeaderRow()) {
         Cells var1 = this.g().d().getCells();
         Row var2 = var1.checkRow(this.j);
         if (var2 != null) {
            for(int var3 = 0; var3 < this.o.getCount(); ++var3) {
               ListColumn var4 = this.o.get(var3);
               Cell var5 = var2.c(var4.d());
               switch(var5.getType()) {
               case 3:
                  break;
               case 5:
                  var4.a(com.aspose.cells.b.a.zv.a(var5.j(), "\r", ""));
                  break;
               default:
                  var5.putValue(var5.j());
                  var4.a(com.aspose.cells.b.a.zv.a(var5.j(), "\r", ""));
               }
            }

         }
      }
   }

   boolean a(int var1, int var2) {
      if (var2 == 0) {
         return false;
      } else {
         CellArea var3 = new CellArea();
         var3.StartColumn = this.l;
         var3.EndColumn = this.m;
         var3.StartRow = this.j;
         var3.EndRow = this.k;
         boolean var4 = false;
         boolean[] var5 = new boolean[]{var4};
         var3 = zayd.b(var3, var1, var2, var5);
         var4 = var5[0];
         if (var4) {
            return true;
         } else {
            int var6;
            for(var6 = 0; var6 < this.o.getCount(); ++var6) {
               ListColumn var7 = this.o.get(var6);
               var7.b(var1, var2);
            }

            int var8;
            int var9;
            int var12;
            if (var2 < 0) {
               var6 = var1 - var2 - 1;
               if (var6 >= this.l) {
                  if (var1 < this.l) {
                     var12 = var6 - this.l + 1;

                     for(var8 = 0; var8 < var12; ++var8) {
                        this.o.removeAt(0);
                     }
                  } else if (var1 <= this.m) {
                     var12 = var1 - this.l;
                     if (var6 < this.m) {
                        for(var8 = 0; var8 < -var2; ++var8) {
                           this.o.removeAt(var12);
                        }
                     } else {
                        var8 = this.m - var1 + 1;

                        for(var9 = 0; var9 < var8; ++var9) {
                           this.o.removeAt(var12);
                        }
                     }
                  }
               }
            } else if (var1 > this.l && var1 <= this.m) {
               var6 = var1 - this.l;
               var12 = this.getListColumns().getCount();
               var8 = this.getListColumns().a();

               for(var9 = 0; var9 < var2; ++var9) {
                  ++var8;
                  String var10 = "Column" + (var9 + var12 + 1);
                  ListColumn var11 = new ListColumn(this.getListColumns(), var10, var8);
                  this.o.a(var6 + var9, var11);
                  var11.setName(var10);
               }
            }

            this.j = var3.StartRow;
            this.l = var3.StartColumn;
            this.k = var3.EndRow;
            this.m = var3.EndColumn;
            if (this.d != null) {
               this.d.b(var1, var2);
            }

            return false;
         }
      }
   }

   boolean a(int var1, int var2, int var3, int var4) {
      if (var2 <= this.m && var2 + var4 - 1 >= this.l) {
         int var5 = var1 + var3 - 1;
         if (var5 >= this.j && var1 <= this.j) {
            return var5 >= this.k;
         } else {
            return true;
         }
      } else {
         return true;
      }
   }

   boolean b(int var1, int var2) {
      CellArea var3 = new CellArea();
      var3.StartColumn = this.l;
      var3.EndColumn = this.m;
      var3.StartRow = this.j;
      var3.EndRow = this.k;
      boolean var4 = false;
      boolean[] var5 = new boolean[]{var4};
      var3 = zayd.a(var3, var1, var2, var5);
      var4 = var5[0];
      if (var4) {
         return true;
      } else {
         if (var2 < 0 && var3.StartRow == var3.EndRow && this.getShowHeaderRow()) {
            ++var3.EndRow;
         }

         this.j = var3.StartRow;
         this.l = var3.StartColumn;
         this.k = var3.EndRow;
         this.m = var3.EndColumn;

         for(int var6 = 0; var6 < this.o.getCount(); ++var6) {
            ListColumn var7 = this.o.get(var6);
            var7.a(var1, var2);
         }

         if (this.d != null) {
            this.d.a(var1, var2);
         }

         return false;
      }
   }

   boolean a(CellArea var1, int var2, int var3) {
      switch(var3) {
      case 0:
         if (var1.StartColumn <= this.getStartColumn() && var1.EndColumn >= this.getEndColumn()) {
            return this.b(var1.StartRow, var2);
         }
         break;
      case 1:
         if (var1.StartRow <= this.getStartRow() && var1.EndRow >= this.getEndRow()) {
            return this.a(var1.StartColumn, -var2);
         }
      case 2:
      default:
         break;
      case 3:
         if (var1.StartRow <= this.getStartRow() && var1.EndRow >= this.getEndRow()) {
            return this.a(var1.StartColumn, var2);
         }
         break;
      case 4:
         if (var1.StartColumn <= this.getStartColumn() && var1.EndColumn >= this.getEndColumn()) {
            return this.b(var1.StartRow, -var2);
         }
      }

      return false;
   }

   String f() {
      return this.n;
   }

   ListObjectCollection g() {
      return this.p;
   }

   public int getDataSourceType() {
      return this.c;
   }

   long h() {
      return this.q;
   }

   void a(long var1) {
      this.q = var1;
   }

   boolean i() {
      return (this.q & 4294967295L & 16L) != 0L;
   }

   void a(boolean var1) {
      if (var1) {
         this.q |= 16L;
      } else {
         this.q &= 4294967279L;
      }

   }

   boolean j() {
      return (this.q & 4294967295L & 64L) != 0L;
   }

   void b(boolean var1) {
      if (var1) {
         this.q |= 64L;
      } else {
         this.q &= 4294967231L;
      }

   }

   boolean k() {
      return (this.q & 4294967295L & 512L) != 0L;
   }

   void c(boolean var1) {
      if (var1) {
         this.q |= 512L;
      } else {
         this.q &= 4294966783L;
      }

   }

   boolean l() {
      return (this.q & 4294967295L & 16384L) != 0L;
   }

   boolean m() {
      return (this.q & 4294967295L & 1048576L) != 0L;
   }

   boolean n() {
      return (this.q & 4294967295L & 16777216L) != 0L;
   }

   void d(boolean var1) {
      if (var1) {
         this.q |= 16777216L;
      } else {
         this.q &= 4278190079L;
      }

   }

   void a(String var1) {
      this.r = var1;
   }

   void b(String var1) {
      this.s = var1;
   }

   void f(int var1) {
      this.t = var1;
   }

   void g(int var1) {
      this.u = var1;
   }

   void h(int var1) {
      this.v = var1;
   }

   void i(int var1) {
      this.w = var1;
   }

   int o() {
      return this.x;
   }

   void j(int var1) {
      this.x = var1;
   }

   byte[] p() {
      return this.y;
   }

   void a(byte[] var1) {
      this.y = var1;
   }

   boolean q() {
      if (this.d == null) {
         return false;
      } else {
         return this.d.f() != 0;
      }
   }

   AutoFilter r() {
      return this.d;
   }

   public AutoFilter getAutoFilter() {
      if (this.d == null) {
         this.d = new AutoFilter(this.p.d(), this);
      }

      return this.d;
   }

   public String getDisplayName() {
      return this.z == null ? this.n : this.z;
   }

   public void setDisplayName(String value) {
      if (!com.aspose.cells.b.a.zv.b(this.z, value)) {
         if (this.z != null) {
            this.F().d.remove(this.z);
         }

         if (value != null) {
            this.F().d.put(value.toUpperCase(), this);
         }
      }

      this.z = value;
   }

   String s() {
      return this.A;
   }

   void c(String var1) {
      this.A = var1;
   }

   byte t() {
      return this.B;
   }

   public boolean getShowTableStyleFirstColumn() {
      return (this.B & 255 & 1) != 0;
   }

   public void setShowTableStyleFirstColumn(boolean value) {
      if (value) {
         this.B = (byte)(this.B | 1);
      } else {
         this.B = (byte)(this.B & 254);
      }

   }

   public boolean getShowTableStyleLastColumn() {
      return (this.B & 255 & 2) != 0;
   }

   public void setShowTableStyleLastColumn(boolean value) {
      if (value) {
         this.B = (byte)(this.B | 2);
      } else {
         this.B = (byte)(this.B & 253);
      }

   }

   public boolean getShowTableStyleRowStripes() {
      return (this.B & 255 & 4) != 0;
   }

   public void setShowTableStyleRowStripes(boolean value) {
      if (value) {
         this.B = (byte)(this.B | 4);
      } else {
         this.B = (byte)(this.B & 251);
      }

   }

   public boolean getShowTableStyleColumnStripes() {
      return (this.B & 255 & 8) != 0;
   }

   public void setShowTableStyleColumnStripes(boolean value) {
      if (value) {
         this.B = (byte)(this.B | 8);
      } else {
         this.B = (byte)(this.B & 247);
      }

   }

   public void applyStyleToRange() {
      Style var1 = this.F().D();

      for(int var2 = this.getStartRow(); var2 <= this.getEndRow(); ++var2) {
         Row var3 = this.g().d().getCells().getRows().get(var2);

         for(int var4 = this.getStartColumn(); var4 <= this.getEndColumn(); ++var4) {
            Style var5 = this.d(var2, var4);
            Cell var6 = var3.a(var4, false, true);
            Style var7 = var6.getStyle();
            zka.a(var7, var5, var1);
            var6.setStyle(var7);
         }
      }

   }

   public void convertToRange() {
      this.applyStyleToRange();
      this.g().b(this);
   }

   TableStyle u() {
      if (this.C == null) {
         return this.p.d().c().getTableStyles().getBuiltinTableStyle(30);
      } else if (this.C instanceof String) {
         return this.p.d().c().getTableStyles().get((String)this.C);
      } else {
         return this.C instanceof Integer ? this.p.d().c().getTableStyles().getBuiltinTableStyle((Integer)this.C) : this.p.d().c().getTableStyles().getBuiltinTableStyle(30);
      }
   }

   public int getTableStyleType() {
      if (this.C == null) {
         return 0;
      } else {
         return this.C instanceof String ? 61 : (Integer)this.C;
      }
   }

   public void setTableStyleType(int value) {
      this.C = value;
      this.G();
   }

   public String getTableStyleName() {
      if (this.C == null) {
         return null;
      } else {
         return this.C instanceof String ? (String)this.C : zbsj.a((Integer)this.C);
      }
   }

   public void setTableStyleName(String value) {
      int var2 = zbsj.a(value);
      if (var2 != 61) {
         this.C = var2;
      } else {
         this.C = value;
      }

      this.G();
   }

   Style v() {
      if (this.e == null) {
         this.e = new Style(this.F());
         this.e.a((byte)0);
      }

      return this.e;
   }

   zbvr a(Style var1) {
      if (var1 != null) {
         zbvr var2 = new zbvr();
         var2.a(var1);
         if (var2.getCount() < 1) {
            var2 = null;
         }

         return var2;
      } else {
         return null;
      }
   }

   Style w() {
      if (this.f == null) {
         this.f = new Style(this.F());
         this.f.a((byte)0);
      }

      return this.f;
   }

   Style x() {
      if (this.g == null) {
         this.g = new Style(this.F());
         this.g.a((byte)0);
      }

      return this.g;
   }

   void k(int var1) {
      this.i = var1;
      if (var1 > this.g().d().c().j) {
         this.g().d().c().j = var1;
      }

   }

   void d(String var1) {
      this.n = var1;
   }

   int y() {
      return this.D;
   }

   void l(int var1) {
      this.D = var1;
   }

   String z() {
      CellArea var1 = new CellArea();
      var1.StartRow = this.getStartRow();
      var1.StartColumn = this.getStartColumn();
      var1.EndRow = this.getEndRow();
      if (this.getEndRow() - this.getStartRow() == 0) {
         ++var1.EndRow;
      }

      var1.EndColumn = this.getEndColumn();
      return zase.a(var1);
   }

   int A() {
      return this.E;
   }

   void m(int var1) {
      this.E = var1;
   }

   boolean B() {
      return this.d != null && this.d.getRange() != null;
   }

   void C() {
      if (this.j()) {
         Cells var1 = this.g().d().getCells();

         for(int var2 = 0; var2 < this.getListColumns().getCount(); ++var2) {
            ListColumn var3 = this.getListColumns().get(var2);
            if (var3.k() != null && var3.getTotalsCalculation() == 0) {
               Cell var4 = var1.a(this.k, this.l + var2, false);
               if (var4.d()) {
                  var4.putValue(var3.k());
               }
            }
         }
      }

      for(int var6 = 0; var6 < this.getListColumns().getCount(); ++var6) {
         ListColumn var7 = this.getListColumns().get(var6);

         try {
            var7.i();
         } catch (Exception var5) {
            ;
         }
      }

   }

   int c(int var1, int var2) {
      if (this.F == null) {
         this.F = new ListObject.za(this, var1);
      }

      return this.F.b(var1, var2);
   }

   Style n(int var1) {
      return this.F.a(var1);
   }

   Style d(int var1, int var2) {
      if (this.F == null) {
         this.F = new ListObject.za(this, var1);
      }

      return this.F.c(var1, var2);
   }

   void D() {
      if (this.F == null) {
         this.F = new ListObject.za(this, -1);
      }

   }

   private void G() {
      this.F = null;
   }

   private zda a(int var1, int var2, int var3, int var4, int var5) {
      zda var6 = new zda();
      int var7 = var2 - 1;
      int var8 = var2 + 1;
      int var9 = var3 - 1;
      int var10 = var3 + 1;
      int var11 = var4 - 1;
      int var12 = var4 + 1;
      switch(var1) {
      case 3:
      case 4:
         if (var4 == 0) {
            var6.c = true;
            if (var4 == var5 - 1) {
               var6.d = true;
            } else if (var12 <= var5 - 1) {
               var6.h = true;
            }
         } else if (var4 == var5 - 1) {
            var6.d = true;
            if (var4 == 0) {
               var6.c = true;
            } else if (var11 >= 0) {
               var6.g = true;
            }
         } else if (var4 > 0 && var4 < var5 - 1) {
            var6.g = true;
            var6.h = true;
         }

         if (var2 == this.j) {
            var6.a = true;
            if (var2 == this.k) {
               var6.b = true;
            } else if (var8 <= this.k) {
               var6.f = true;
            }
         } else if (var2 == this.k) {
            var6.b = true;
            if (var2 == this.j) {
               var6.a = true;
            } else if (var7 >= this.j) {
               var6.e = true;
            }
         } else if (var2 > this.j && var2 < this.k) {
            var6.e = true;
            var6.f = true;
         }
         break;
      case 5:
      case 6:
         if (var4 == 0) {
            var6.a = true;
            if (var4 == var5 - 1) {
               var6.b = true;
            } else if (var12 <= var5 - 1) {
               var6.f = true;
            }
         } else if (var4 == var5 - 1) {
            var6.b = true;
            if (var4 == 0) {
               var6.a = true;
            } else if (var11 >= 0) {
               var6.e = true;
            }
         } else if (var4 > 0 && var4 < var5 - 1) {
            var6.e = true;
            var6.f = true;
         }

         if (var3 == this.l) {
            var6.c = true;
            if (var3 == this.m) {
               var6.d = true;
            } else if (var10 <= this.m) {
               var6.h = true;
            }
         } else if (var3 == this.m) {
            var6.d = true;
            if (var3 == this.l) {
               var6.c = true;
            } else if (var9 >= this.l) {
               var6.g = true;
            }
         } else if (var3 > this.l && var3 < this.m) {
            var6.g = true;
            var6.h = true;
         }
         break;
      case 7:
      case 8:
         var6.c = var6.d = true;
         if (var2 == this.j) {
            var6.a = true;
            if (var2 == this.k) {
               var6.b = true;
            } else if (var8 <= this.k) {
               var6.f = true;
            }
         } else if (var2 == this.k) {
            var6.b = true;
            if (var2 == this.j) {
               var6.a = true;
            } else if (var7 >= this.j) {
               var6.e = true;
            }
         } else if (var2 > this.j && var2 < this.k) {
            var6.e = true;
            var6.f = true;
         }
         break;
      case 9:
      case 10:
         var6.a = var6.b = true;
         if (var3 == this.l) {
            var6.c = true;
            if (var3 == this.m) {
               var6.d = true;
            } else if (var10 <= this.m) {
               var6.h = true;
            }
         } else if (var3 == this.m) {
            var6.d = true;
            if (var3 == this.l) {
               var6.c = true;
            } else if (var9 >= this.l) {
               var6.g = true;
            }
         } else if (var3 > this.l && var3 < this.m) {
            var6.g = true;
            var6.h = true;
         }
         break;
      case 11:
      case 12:
      case 13:
      case 14:
         var6.a = var6.b = var6.c = var6.d = true;
         break;
      default:
         if (var2 == this.j) {
            var6.a = true;
            if (var2 == this.k) {
               var6.b = true;
            } else if (var8 <= this.k) {
               var6.f = true;
            }
         } else if (var2 == this.k) {
            var6.b = true;
            if (var2 == this.j) {
               var6.a = true;
            } else if (var7 >= this.j) {
               var6.e = true;
            }
         } else if (var2 > this.j && var2 < this.k) {
            var6.e = true;
            var6.f = true;
         }

         if (var3 == this.l) {
            var6.c = true;
            if (var3 == this.m) {
               var6.d = true;
            } else if (var10 <= this.m) {
               var6.h = true;
            }
         } else if (var3 == this.m) {
            var6.d = true;
            if (var3 == this.l) {
               var6.c = true;
            } else if (var9 >= this.l) {
               var6.g = true;
            }
         } else if (var3 > this.l && var3 < this.m) {
            var6.g = true;
            var6.h = true;
         }
      }

      return var6;
   }

   CellArea E() {
      CellArea var1 = new CellArea();
      var1.StartRow = this.j;
      var1.StartColumn = this.l;
      var1.EndRow = this.k;
      var1.EndColumn = this.m;
      return var1;
   }

   private class za {
      private ListObject b;
      private TableStyle c;
      private WorksheetCollection d;
      private zbvx e;
      private int f;
      private int g;
      private int[][] h;
      private int[] i;
      private int[] j;
      private int k = -1;
      private int l = -1;
      private int m = -1;
      private int n = -1;
      private int o = 0;
      private int[] p;
      private zda[] q;
      private Style[] r;
      private StringBuilder s;
      private HashMap t;
      private int[] u = null;
      private int[] v = null;

      za(ListObject var2, int var3) {
         this.b = var2;
         this.c = var2.u();
         if (this.c == null) {
            this.f = -1;
            this.g = -1;
         } else {
            this.d = var2.F();
            this.e = new zbvx(this.d);
            this.f = this.e.b(new Style(this.d));
            this.g = var2.j;
            this.p = new int[32];
            this.q = new zda[this.p.length];
            this.s = new StringBuilder(6 * this.p.length);
            this.t = new HashMap();
            this.r = new Style[this.p.length];
            TableStyleElementCollection var5 = this.c.getTableStyleElements();

            TableStyleElement var4;
            int var6;
            for(var6 = var5.getCount() - 1; var6 > -1; --var6) {
               var4 = var5.get(var6);
               if (var4.a() != null) {
                  this.r[var4.getType()] = var4.a();
               }
            }

            if (var2.getShowTableStyleColumnStripes()) {
               var4 = this.c.getTableStyleElements().getByTableStyleElementType(3);
               this.k = 1;
               if (var4 != null) {
                  this.k = var4.getSize();
               }

               var4 = this.c.getTableStyleElements().getByTableStyleElementType(4);
               this.l = 1;
               if (var4 != null) {
                  this.l = var4.getSize();
               }
            }

            if (var2.getShowTableStyleRowStripes()) {
               var4 = this.c.getTableStyleElements().getByTableStyleElementType(5);
               this.m = 1;
               if (var4 != null) {
                  this.m = var4.getSize();
               }

               var4 = this.c.getTableStyleElements().getByTableStyleElementType(6);
               this.n = 1;
               if (var4 != null) {
                  this.n = var4.getSize();
               }
            }

            var6 = var2.k - var2.j + 1;
            int var7 = var2.m - var2.l + 1;
            this.h = new int[var2.k - var2.j + 1][];
            this.i = new int[var2.m - var2.l + 1];
            com.aspose.cells.a.c.zc.a((int[])this.i, 0, this.i.length, (int)-1);
            this.j = new int[var7];
            if (var3 < 0) {
               var3 = var2.g().d().getCells().getMaxRow() + 1;
            }

            if (var3 > var2.k) {
               var3 = var2.k;
            } else if (var3 < var2.j) {
               var3 = var2.j;
            }

            this.b(var3);
            if (var3 == var2.k) {
               this.a();
            }

         }
      }

      void a(int var1, int var2) {
         int var3;
         if (this.u == null) {
            var3 = this.b.getEndRow() - this.b.getStartRow() + 1;
            this.u = new int[var3];
            com.aspose.cells.a.c.zc.a((int[])this.u, 0, var3, (int)-1);
         }

         int var5;
         int var6;
         if (this.u[var1 - this.b.j] < 0) {
            var3 = 0;
            RowCollection var4 = this.b.g().d().getCells().getRows();
            var5 = this.b.getStartRow();
            if (this.b.getShowHeaderRow() && var4.get(var5).isHidden()) {
               ++var5;
            }

            for(var6 = var5; var6 < var1; ++var6) {
               if (var4.get(var6).isHidden()) {
                  ++var3;
               }
            }

            this.u[var1 - this.b.j] = var3;
         }

         if (this.v == null) {
            var3 = this.b.getEndColumn() - this.b.getStartColumn() + 1;
            this.v = new int[var3];
            com.aspose.cells.a.c.zc.a((int[])this.v, 0, var3, (int)-1);
         }

         if (this.v[var2 - this.b.l] < 0) {
            var3 = 0;
            ColumnCollection var7 = this.b.g().d().getCells().getColumns();
            var5 = this.b.getStartColumn();

            for(var6 = var5; var6 < var2; ++var6) {
               if (var7.get(var6).isHidden()) {
                  ++var3;
               }
            }

            this.v[var2 - this.b.l] = var3;
         }

      }

      int b(int var1, int var2) {
         if (this.g < 0) {
            return this.f;
         } else {
            if (var1 >= this.g) {
               if (var1 + 1 < this.b.k) {
                  this.b(var1 + 1);
               } else {
                  this.b(this.b.k);
                  this.a();
               }
            }

            if (!this.b.j() || var1 != this.b.getEndRow()) {
               this.a(var1, var2);
               if (var1 - this.b.j < this.u.length) {
                  var1 -= this.u[var1 - this.b.j];
               }

               if (var2 - this.b.l < this.v.length) {
                  var2 -= this.v[var2 - this.b.l];
               }
            }

            return this.h[var1 - this.b.j][var2 - this.b.l];
         }
      }

      Style c(int var1, int var2) {
         return this.a(this.b(var1, var2));
      }

      Style a(int var1) {
         return var1 < 0 ? null : this.e.a(var1);
      }

      private void a() {
         this.i = null;
         this.j = null;
         this.p = null;
         this.q = null;
         this.r = null;
         this.s = null;
         this.t = null;
      }

      private void b(int var1) {
         while(this.g <= var1) {
            com.aspose.cells.a.c.zc.a((int[])this.j, 0, this.j.length, (int)-1);
            int var2 = this.g - this.b.j;
            int[] var3 = new int[this.j.length];
            this.h[var2] = var3;

            for(int var4 = 0; var4 < this.j.length; ++var4) {
               this.d(this.g, var4 + this.b.l);
               Style var6 = null;
               Object[] var8 = null;
               int var5;
               int var7;
               if (this.o < 1) {
                  var5 = this.f;
                  var7 = -1;
               } else {
                  this.s.setLength(0);
                  this.s.append(this.a(this.p[0], this.q[0]));
                  if (this.o > 1) {
                     for(int var9 = 1; var9 < this.o; ++var9) {
                        this.s.append('-');
                        this.s.append(this.a(this.p[var9], this.q[var9]));
                     }
                  }

                  String var12 = com.aspose.cells.b.a.zr.a(this.s);
                  Object var10 = this.t.get(var12);
                  if (var10 != null) {
                     var8 = (Object[])((Object[])var10);
                     var6 = (Style)var8[0];
                     var7 = (Integer)var8[2];
                  } else {
                     var7 = -1;
                     var6 = new Style(this.d);

                     for(int var11 = 0; var11 < this.o; ++var11) {
                        var7 = zka.a(var6, this.r[this.p[var11]], this.q[var11], this.p[var11], var7);
                     }

                     var8 = new Object[]{var6, -1, var7};
                     this.t.put(var12, var8);
                  }

                  this.j[var4] = var7;
                  var5 = -2;
               }

               Style var13;
               if (var2 > 0) {
                  if (zka.a(var7, 4) > zka.a(this.i[var4], 8) && var6.isModified(4)) {
                     var13 = new Style(this.d);
                     var13.copy(this.e.a(this.h[var2 - 1][var4]));
                     var13.getBorders().getByBorderType(8).a(var6.getBorders().getByBorderType(4));
                     var13.b(5);
                     this.h[var2 - 1][var4] = this.e.b(var13);
                  } else if (zka.a(this.i[var4], 8) > zka.a(var7, 4) && this.e.a(this.h[var2 - 1][var4]).isModified(5)) {
                     if (var5 > -1) {
                        var6 = new Style(this.d);
                     } else {
                        var13 = new Style(this.d);
                        var13.copy(var6);
                        var6 = var13;
                     }

                     var5 = -1;
                     var6.getBorders().getByBorderType(4).a(this.e.a(this.h[var2 - 1][var4]).getBorders().getByBorderType(8));
                     var6.b(4);
                  }
               }

               if (var4 > 0) {
                  if (zka.a(var7, 1) > zka.a(this.j[var4 - 1], 2) && var6.isModified(2)) {
                     var13 = new Style(this.d);
                     var13.copy(this.e.a(var3[var4 - 1]));
                     var13.getBorders().getByBorderType(2).a(var6.getBorders().getByBorderType(1));
                     var13.b(3);
                     var3[var4 - 1] = this.e.b(var13);
                  } else if (zka.a(this.j[var4 - 1], 2) > zka.a(var7, 1) && this.e.a(var3[var4 - 1]).isModified(3)) {
                     if (var5 > -1) {
                        var6 = new Style(this.d);
                        var5 = -1;
                     } else if (var5 < -1) {
                        var13 = new Style(this.d);
                        var13.copy(var6);
                        var6 = var13;
                        var5 = -1;
                     }

                     var6.getBorders().getByBorderType(1).a(this.e.a(var3[var4 - 1]).getBorders().getByBorderType(2));
                     var6.b(2);
                  }
               }

               if (var5 > -1) {
                  var3[var4] = var5;
               } else if (var5 < -1) {
                  var5 = (Integer)var8[1];
                  if (var5 < 0) {
                     var5 = this.e.b(var6);
                     var8[1] = var5;
                  }

                  var3[var4] = var5;
               } else {
                  var3[var4] = this.e.b(var6);
               }
            }

            var3 = this.i;
            this.i = this.j;
            this.j = var3;
            ++this.g;
         }

      }

      private void d(int var1, int var2) {
         boolean var3 = false;
         int var4 = this.b.j;
         if (this.b.y() > 0 && this.b.getShowTotals()) {
            var3 = var1 > this.b.j && var1 < this.b.k;
            ++var4;
         } else if (this.b.y() == 0 && this.b.getShowTotals()) {
            var3 = var1 >= this.b.j && var1 < this.b.k;
         } else if (this.b.y() > 0 && !this.b.getShowTotals()) {
            var3 = var1 > this.b.j && var1 <= this.b.k;
            ++var4;
         } else {
            var3 = var1 >= this.b.j && var1 <= this.b.k;
         }

         this.o = 0;
         this.a(0, var1, var2, -1, -1);
         int var5;
         int var6;
         if (this.k > -1) {
            var5 = (var2 - this.b.l) % (this.k + this.l);
            if (var3 && var5 >= 0 && var5 < this.k) {
               this.a(3, var1, var2, var5, this.k);
            }

            var6 = var5 - this.k;
            if (var3 && var6 >= 0 && var6 < this.l) {
               this.a(4, var1, var2, var6, this.l);
            }
         }

         if (this.m > -1) {
            var5 = (var1 - var4) % (this.m + this.n);
            if (var3 && var5 >= 0 && var5 < this.m) {
               this.a(5, var1, var2, var5, this.m);
            }

            var6 = var5 - this.m;
            if (var3 && var6 >= 0 && var6 < this.n) {
               this.a(6, var1, var2, var6, this.n);
            }
         }

         if (this.b.getShowTableStyleLastColumn() && var2 == this.b.m) {
            this.a(7, var1, var2, -1, -1);
         }

         if (this.b.getShowTableStyleFirstColumn() && var2 == this.b.l) {
            this.a(8, var1, var2, -1, -1);
         }

         if (this.b.y() > 0 && var1 == this.b.j) {
            this.a(9, var1, var2, -1, -1);
         }

         if (this.b.getShowTotals() && var1 == this.b.k) {
            this.a(10, var1, var2, -1, -1);
         }

         if (this.b.y() > 0 && var1 == this.b.j && var2 == this.b.l) {
            this.a(11, var1, var2, -1, -1);
         }

         if (this.b.y() > 0 && var1 == this.b.j && var2 == this.b.m) {
            this.a(12, var1, var2, -1, -1);
         }

         if (this.b.getShowTotals() && var1 == this.b.k && var2 == this.b.l) {
            this.a(13, var1, var2, -1, -1);
         }

         if (this.b.getShowTotals() && var1 == this.b.k && var2 == this.b.m) {
            this.a(14, var1, var2, -1, -1);
         }

      }

      private void a(int var1, int var2, int var3, int var4, int var5) {
         if (this.r[var1] != null) {
            this.p[this.o] = var1;
            this.q[this.o] = this.b.a(var1, var2, var3, var4, var5);
            ++this.o;
         }

      }

      private int a(int var1, zda var2) {
         int var3 = var1 << 8;
         if (var2.b) {
            var3 |= 1;
         }

         if (var2.f) {
            var3 |= 2;
         }

         if (var2.e) {
            var3 |= 4;
         }

         if (var2.c) {
            var3 |= 8;
         }

         if (var2.d) {
            var3 |= 16;
         }

         if (var2.a) {
            var3 |= 32;
         }

         if (var2.g) {
            var3 |= 64;
         }

         if (var2.h) {
            var3 |= 128;
         }

         return var3;
      }
   }
}
